package com.gxa.meiye.admin.platform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxa.meiye.admin.platform.pojo.vo.AppraiseVo;
import com.gxa.meiye.admin.platform.pojo.vo.SelectAppShopVo;
import com.gxa.meiye.admin.platform.pojo.vo.SelectAppUserVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Component
public interface AppraiseMapper extends BaseMapper<AppraiseVo> {

    @Select("SELECT *\n" +
            "    FROM t_appraise\n" +
            "    WHERE user_id IN (\n" +
            "    SELECT id\n" +
            "    FROM t_consumer\n" +
            "    WHERE `name` LIKE #{select})")
    List<AppraiseVo> selectAppraise(String select);

    @Select("SELECT phone,name\n" +
            "  FROM t_consumer\n" +
            "  WHERE id = #{id}")
    SelectAppUserVo selectUserById(Integer id);

    @Select("SELECT shop_id,therapist_id\n" +
            "FROM t_order\n" +
            "WHERE id = #{id}")
    SelectAppShopVo selectShopById(Integer id);

    @Select("SELECT name\n" +
            "  FROM t_therapist\n" +
            "  WHERE id = #{id}")
    String selectTherapistName(Integer id);

    @Select("SELECT name\n" +
            "  FROM t_shop\n" +
            "  WHERE id = #{id}")
    String selectShopName(Integer id);
}
